#ifndef _URISTREAMFACTORY_HPP_
#define _URISTREAMFACTORY_HPP_

#include "jhdefs.hpp"
#include <istream>
#include <string>
#include "filesys/path.hpp"
using JHCPP::filesys::CPath;

NET_NAMESPACE_BEGIN

class CURI;
class CURIStreamFactory
{
public:
	CURIStreamFactory();
	virtual std::istream* open(const CURI& uri) = 0;

protected:
	virtual ~CURIStreamFactory();

private:
	CURIStreamFactory(const CURIStreamFactory&);
	CURIStreamFactory& operator = (const CURIStreamFactory&);

	friend class CURIStreamOpener;
};


class CURIRedirection
{
public:
	CURIRedirection(const std::string& uri);
	CURIRedirection(const CURIRedirection& redir);

	CURIRedirection& operator = (const CURIRedirection& redir);
	void swap(CURIRedirection& redir);

	const std::string& uri() const;

private:
	CURIRedirection();

	std::string m_uri;
};


class CFileStreamFactory : public CURIStreamFactory
{
public:
	CFileStreamFactory();
	~CFileStreamFactory();

	std::istream* open(const CURI& uri);
	std::istream* open(const CPath& path);
};

NET_NAMESPACE_END

#endif
